MACRO(INSTALL_HEADERS_WITH_DIRECTORY HEADER_LIST DESTINATION_DIR)
FOREACH(HEADER ${HEADER_LIST})
    STRING(REGEX MATCH "(.*)[/\\]" DIR ${HEADER})
    INSTALL(FILES ${HEADER} DESTINATION ${DESTINATION_DIR}/${DIR})
ENDFOREACH(HEADER)
ENDMACRO(INSTALL_HEADERS_WITH_DIRECTORY)

MACRO(COPY_HEADERS_WITH_DIRECTORY HEADER_LIST DESTINATION_DIR)
FOREACH(HEADER ${HEADER_LIST})
    STRING(REGEX MATCH "(.*)[/\\]" DIR ${HEADER})
    FILE(COPY ${HEADER} DESTINATION ${DESTINATION_DIR}/${DIR})
ENDFOREACH(HEADER)
ENDMACRO(COPY_HEADERS_WITH_DIRECTORY)
